import Routes from '@/router/index'
import React, { useState, useEffect } from 'react'
import { ConfigProvider } from 'antd'
import zhCN from 'antd/locale/zh_CN';  //国际化
import debounce from 'lodash.debounce';
import './index.scss'

const App = () => {
    const getScale = () => {
        const width = 1920;
        // const height = 1080;
        const height = 961;
        let ww = window.innerWidth / width;
        let wh = window.innerHeight / height;
        return ww < wh ? ww : wh;
    }
    const [pageScale, setPageScale] = useState(getScale())

    const setScale = debounce(() => {
        let scale = getScale();
        setPageScale(scale)
    }, 500)


    useEffect(() => {
        window.addEventListener('resize', setScale);
        return () => {
            window.removeEventListener('resize', setScale)
        }
    }, [])


    const width = 1920
    const height = 961;
    return (
        /*   <div
              className={'appBox'}
              style={{
                  transform: `scale(${pageScale}) translate(-50%, -50%)`,
                  WebkitTransform: `scale(${pageScale}) translate(-50%, -50%)`,
                  width,
                  height
              }}
          >
              <ConfigProvider locale={zhCN}>
                  <Routes />
              </ConfigProvider>
          </div> */
              //ConfigProvider 配置主题
        <ConfigProvider locale={zhCN} theme={{token:{colorText:'#0F1D35'}}}>
            <Routes />
        </ConfigProvider>
    );
}

export default App;
